package com.chris.homecare.screens.events
{
	import com.chris.homecare.components.renderers.EventListRenderer;
	import com.chris.homecare.data.DataUtil;
	import com.chris.homecare.data.GlobalVariables;
	
	import feathers.controls.List;
	import feathers.controls.Screen;
	import feathers.controls.renderers.IListItemRenderer;
	import feathers.data.ListCollection;
	
	import starling.display.Quad;
	
	public class CategoryEventsListScreen extends Screen
	{
		private var eventList:List;
		private var eventsListCollection:ListCollection;
		
		public function CategoryEventsListScreen()
		{
			super();
			eventsListCollection = DataUtil.getAllEventsForCategory(GlobalVariables.choosenEventCategory);
		}
		
		override protected function initialize():void
		{
			eventList = new List();
			eventList.dataProvider = eventsListCollection;
			eventList.itemRendererFactory = function ():IListItemRenderer
			{
				var renderer:EventListRenderer = new EventListRenderer();
				return renderer;
			};
			addChild(eventList);
			eventList.backgroundSkin = new Quad(10,10,0xFFFFFF);
			eventList.backgroundDisabledSkin = new Quad(10,10,0xFFFFFF);
			
			super.initialize();
		}
		
		override protected function draw():void
		{
			eventList.width = this.width;
			eventList.height = this.height;
			
			super.draw();
		}
		
	}
}